import request from '../../../../yuntai-template/src/utils/request'

const api_name = '/admin/acl/user'

export default {

  getPageList(page, limit,searchObj) {
    return request({
      url: `${api_name}/${page}/${limit}/`,
      method: 'get',
      params: searchObj
    })
  },
  getById(id) {
    return request({
      url: `${api_name}/get/${id}`,
      method: 'get'
    })
  },

  save(role) {
    return request({
      url: `${api_name}/save`,
      method: 'post',
      data: role
    })
  },

  updateById(role) {
    return request({
      url: `${api_name}/update`,
      method: 'put',
      data: role
    })
  },
  removeById(id) {
    return request({
      url: `${api_name}/remove/${id}`,
      method: 'delete'
    })
  },

  getRoles(adminId) {
    return request({
      url: `${api_name}/toAssign/${adminId}`,
      method: 'get'
    })
  },

  assignRoles(adminId, roleId) {
    return request({
      url: `${api_name}/doAssign`,
      method: 'post',
      params: {
        adminId,
        roleId
      }
    })
  },

  doAssignWarehouse(adminId, warehouseId) {
    return request({
      url: `${api_name}/doAssignWarehouse`,
      method: 'post',
      params: {
        adminId,
        warehouseId
      }
    })
  }
}
